<template>
    <cfg-form-list slot="right">
        <cfg-title v-bind="config.title"></cfg-title>
        <cfg-form :only-read="onlyRead" v-bind="config.section.start" :data="data"></cfg-form>
        <cfg-subtitle :title="'相关数据:'"></cfg-subtitle>
        <cfg-form :onlyRead="onlyRead" style="border:1px solid #dcdee2;padding-top: 10px;" v-bind="config.section.relateData" :data="data.relateData"></cfg-form>
        <cfg-subtitle :title="'记录:'"></cfg-subtitle>
        <cfg-sheet :onlyRead="onlyRead" v-bind="config.section.records" :data="data.records"></cfg-sheet>
        <Button type="primary" long @click="data.records.push({})">加一行</Button>
        <cfg-subtitle :title="'备注:'"></cfg-subtitle>
        <cfg-form :onlyRead="onlyRead" style="border:1px solid #dcdee2;padding-top: 10px;" v-bind="config.section.comments" :data="data.comments"></cfg-form>
        <cfg-form :only-read="onlyRead" style="margin-top:10px;" v-bind="config.section.end" :data="data"></cfg-form>
    </cfg-form-list>
</template>

<script>
    export default {
        data () {
            return {
                onlyRead: false,
                config: {
                    title: {
                        title: 'WC改配及重新碳化生产通知书',
                        titleStyle: {},
                        outlineStyle: { marginBottom: '20px' }
                    },
                    section: {
                        start: {
                            labelWidth: 70,
                            labelPosition: 'right',
                            cols: 2,
                            columns: [
                                { title: '表单号:', key: 'formNo', config: { type: 'text' } },
                                { title: '流水号:', key: 'No', config: { type: 'text' } }
                            ],
                            rules: {}
                        },
                        relateData: {
                            labelWidth: 110,
                            labelPosition: 'right',
                            cols: 2,
                            columns: [
                                { title: '名称:', key: 'name', config: { type: 'text' } },
                                { title: '批次:', key: 'batchNo', config: { type: 'text' } }
                            ],
                            rules: {}
                        },
                        records: {
                            columns: [
                                { title: 'WC <br/>重量（kg）', align: 'center', key: 'wcWeight', config: { type: 'number' } },
                                { title: 'C原 <br/>（%）', align: 'center', key: 'original', config: { type: 'number' } },
                                { title: 'C要求 <br/>（%）', align: 'center', key: 'request', config: { type: 'number' } },
                                { title: '补W',
                                  align: 'center',
                                  children: [
                                      { title: '批次', align: 'center', key: 'wBatchNo', config: { type: 'text' } },
                                      { title: '重量（kg)', align: 'center', key: 'wWeight', config: { type: 'number' } }
                                  ]
                                },
                                { title: '补C',
                                  align: 'center',
                                  children: [
                                      { title: '批次', align: 'center', key: 'cBatchNo', config: { type: 'text' } },
                                      { title: '重量（kg)', align: 'center', key: 'cWeight', config: { type: 'number' } }
                                  ]
                                },
                                { title: '温度<br/>(摄氏)', align: 'center', key: 'temp', config: { type: 'number' } },
                                { title: '推速<br/>(分/舟)', align: 'center', key: 'speed', config: { type: 'number' } },
                                { title: '装料量<br/>(g/舟)', align: 'center', key: 'weight', config: { type: 'number' } }
                            ]
                        },
                        comments: {
                            labelWidth: 100,
                            labelPosition: 'right',
                            cols: 4,
                            columns: [
                                { title: '清机:', key: 'clear', config: { type: 'select', options: [{ label: '是', value: 'mo' }, { label: '否', value: 'carbon' }] } },
                                { title: '总碳CT:', key: 'ct', config: { type: 'text' } },
                                { title: '费氏FSSS:', key: 'fsss', config: { type: 'text' } }
                            ],
                            rules: {}
                        },
                        end: {
                            labelWidth: 70,
                            labelPosition: 'right',
                            columns: [
                                { title: '通知者:', key: 'notifier', config: { type: 'text' } },
                                { title: '审核:', key: 'auditor', config: { type: 'text' } },
                                { title: '日期:', key: 'date', config: { type: 'date' } }
                            ],
                            cols: 3,
                            rules: {}
                        }
                    }
                }
            };
        },
        props: {
            data: {
                default: () => {
                    return {
                        formNo: '',
                        No: '第  XXXX  号',
                        relateData: {
                            name: '',
                            batchNo: ''
                        },
                        records: [
                            {
                                wcWeight: 0,
                                original: 0,
                                request: 0,
                                wBatchNo: '',
                                wWeight: 0,
                                cBatchNo: '',
                                cWeight: 0,
                                temp: 0,
                                speed: 0,
                                weight: 0
                            }
                        ],
                        comments: {
                            clear: '1',
                            ct: '',
                            fsss: ''
                        },
                        notifier: '',
                        auditor: '',
                        date: '2022-12-06'
                    }
                }
            }
        }
    };
</script>
<style scoped lang="scss"></style>
